package com.duqc.qiangdan;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName DemoController
 * @Description DemoController
 * @Author duqc
 * @Date 2022/2/7
 **/
@Slf4j
@RestController
@RequiredArgsConstructor
public class DemoController {

    private final RedisConfigUtil redisUtil;

    private final QiangdanService service;

    @GetMapping("/setnx/{key}/{val}")
    public boolean setnx(@PathVariable String key, @PathVariable String val) {
        return redisUtil.setnx(key, val);
    }

    @GetMapping("/delnx/{key}/{val}")
    public int delnx(@PathVariable String key, @PathVariable String val) {
        return redisUtil.delnx(key, val);
    }

    @GetMapping("/qiangdan")
    public List<String> qiangdan() {
        return service.qiangdan();
    }

}
